// pages/homework-evaluate-teacher/homework-evaluate-teacher.ts
Page({

  /**
   * 页面的初始数据
   */
  data: {
    picUrl: [],
    scoreArr: [
      { "scoreId": 0, "score": "A" },
      { "scoreId": 1, "score": "B" },
      { "scoreId": 2, "score": "C" },
      { "scoreId": 3, "score": "D" },
    ],
    evaluateType: [
      { label: '绘画技巧', score: 0 },
      { label: '创意性', score: 0 },
      { label: '意境描绘', score: 0 },
      { label: '创作态度', score: 0 },
      { label: '作品内涵', score: 0 },
    ],
    selectedIndex: -1,
  },
  handleSelect(e: any) {
    const { index } = e.currentTarget.dataset;
    this.setData({
      selectedIndex: index
    })
  },
  handleEvaluate(e: any) {
    const { index } = e.currentTarget.dataset;
    const { score } = e.detail;
    const evaluateType = this.data.evaluateType
    evaluateType[index].score = score
    this.setData({
      evaluateType: [
        ...evaluateType
      ]
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad() {
    wx.request({
      url: "https://mock.presstime.cn/mock/656dbe322fef936d34630d40/yi-xiao-ping/gallery-detail",
      success: (res: any) => {
        const { data } = res;
        const { data: picData, code } = data;
        if (code === 200) {
          const { detail } = picData;
          const { picUrl } = detail;
          this.setData({
            picUrl: picUrl,
          })
        }
      }
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})